package com.jokins.admin.vue.role.controller;


import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.jokins.admin.vue.role.param.SysRoleParam;
import com.jokins.admin.vue.role.service.SysRoleService;
import com.jokins.admin.vue.role.vo.SysRoleVo;
import com.jokins.common.util.ResultData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/sysRole")
public class SysRoleController {

    @Autowired
    private SysRoleService sysRoleService;

    @GetMapping("/getRoleList")
    public ResultData getSyRoleList(SysRoleParam param) {
        final Page<Object> page = PageHelper.startPage(param.getCurrentPage(), param.getPageSize(), true);
        List<SysRoleVo> roleVoList= sysRoleService.selectSysRoleList(param);
        return ResultData.pageResponse(roleVoList, page.getTotal(), page.getPages(), page.getPageNum());
    }
}
